﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 十六进制数转换工具
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str = textBox1.Text;
            str = str.Replace(" ", "");
            string str1 = "";

            for (int i = 0; i < str.Length; i++)
            {
                str1 += "0x";
                str1 += str.Substring(i, 2);
                if (i != (str.Length - 2))
                {
                    str1 += ",";
                }
                i++;
            }
            textBox2.Text = "{" + str1 + "};";
        }
    }
}
